package com.linzelin.dao;

import com.linzelin.po.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface UserMapper {

    @Select("select * from user")
    List<User> getUsers();

    @Select("select * from user where id = #{id}")
    User getUserById(@Param("id") int id);
    //如果方法有多个参数,每个都要加上@Param这个注解

    @Insert("insert into user values(#{id} , #{name} ,#{pwd})")
    int addUser(User user);


    @Update("update user set name = #{name} , pwd = #{pwd} where id = #{id} ")
    int updateUser(User user);

    @Delete("delete from user where id = #{id}")
    int deleteUser(int id);
}
